<html>
<head><meta charset="utf-8"><title>creating or updating rustc_middle::ty::list::List · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/creating.20or.20updating.20rustc_middle.3A.3Aty.3A.3Alist.3A.3AList.html">creating or updating rustc_middle::ty::list::List</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210825224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/creating%20or%20updating%20rustc_middle%3A%3Aty%3A%3Alist%3A%3AList/near/210825224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> sfzhu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/creating.20or.20updating.20rustc_middle.3A.3Aty.3A.3Alist.3A.3AList.html#210825224">(Sep 22 2020 at 03:34)</a>:</h4>
<p>I'd like to make some type manipulation --- wrap some int types from a <code>rustc_middle::ty::list::List</code> into a raw pointer.<br>
From its documentation, I couldn't find how to update a <code>list</code>'s values or create a list and replace the old one. (I know I should put interned types into it). I tried to use <code>.iter().map().collect()</code> but keeps giving me the error "value of type <code>&amp;ty::list::List&lt;&amp;ty::TyS&lt;'_&gt;&gt;</code> cannot be built from <code>std::iter::Iterator&lt;Item=&amp;ty::TyS&lt;'_&gt;&gt;</code>". <br>
I guess I should use a <code>TypeFolder</code>. Is it true?</p>



<a name="210825248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/creating%20or%20updating%20rustc_middle%3A%3Aty%3A%3Alist%3A%3AList/near/210825248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/creating.20or.20updating.20rustc_middle.3A.3Aty.3A.3Alist.3A.3AList.html#210825248">(Sep 22 2020 at 03:35)</a>:</h4>
<p>That says you're trying to build a <code>&amp;List</code>, not a List</p>



<a name="210825256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/creating%20or%20updating%20rustc_middle%3A%3Aty%3A%3Alist%3A%3AList/near/210825256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/creating.20or.20updating.20rustc_middle.3A.3Aty.3A.3Alist.3A.3AList.html#210825256">(Sep 22 2020 at 03:35)</a>:</h4>
<p>You can't collect into a reference</p>



<a name="210827240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/creating%20or%20updating%20rustc_middle%3A%3Aty%3A%3Alist%3A%3AList/near/210827240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> sfzhu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/creating.20or.20updating.20rustc_middle.3A.3Aty.3A.3Alist.3A.3AList.html#210827240">(Sep 22 2020 at 04:31)</a>:</h4>
<p>Thanks for your explanation of the compile error! this reminded me of the fact that I should use a <code>tcx.mk_type_list</code> and it worked.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>